/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.femto.compmod;

import org.femto.math.*;
import org.femto.compmod.gui.*;
import java.io.*;
import java.sql.SQLException;

/**
 *
 * @author root
 */
public class Main {

    public static void createAndShowDesktop() throws Exception {
        CompModDesktop desktop = new CompModDesktop();
        desktop.setVisible(true);
        Visualizer visualizer = new Visualizer();
        visualizer.setVisible(true);
        desktop.getDeskPane().add(visualizer);
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Femto1 f = new Femto1();
        f.print();

        try {
            OptionsDatabase.connect(args[0]);
        } catch (ClassNotFoundException e) {
            System.out.println(e.toString());
        } catch (SQLException e) {
            System.out.println(e.toString());
        }

        
        try {
            OptionsDatabase.initLibraryPaths();
        } catch (IOException e) {
            System.err.println(e.toString());
            return;
        } catch (SQLException e) {
            System.err.println(e.toString());
            return;
        }

        System.out.printf("java.library.path=%s\n", System.getProperty("java.library.path"));

        try {
            createAndShowDesktop();
        } catch (Exception e) {
            System.err.println(e.toString());
            return;
        }

        /*
        javax.swing.SwingUtilities.invokeLater(new Runnable() {

            public void run() {
                try {
                    createAndShowDesktop();
                } catch (Exception e) {
                    javax.swing.JOptionPane.showMessageDialog(null, e, null, javax.swing.JOptionPane.ERROR_MESSAGE);
                }
            }
        });*/

    }
}
